package com.lzs.gateway.util;

/**
 * @author 小刘先生
 * @date 2020/12/10 16:16
 */
public class Sutil {
    //查询第几次
    public static int findSindex(String orgStr,String appointStr,int appointnum){
        String[] ss=orgStr.split("");
        int num=0;
        for (int i = 0; i <ss.length ; i++) {
            if (ss[i].equals(appointStr)){
                num++;
                if (num==appointnum){
                    return i;
                }
            }
        }
        return -1;
    }
    //一共出现几次
    public static  int findStrCount(String orgStr,String appointStr){
        String[] ss=orgStr.split("");
        int num=0;
        for (int i = 0; i <ss.length ; i++) {
            if (ss[i].equals(appointStr)){
                num++;
            }
        }
        return num;
    }
}
